<template>
	<view class="d-flex position-fixed bottom-0 left-0 w-100 a-center" style="height: 100upx; background-color: rgb(255, 255, 250);">
		<view class="flex-1 d-flex flex-column a-center j-center" v-for="(item, index) in resdata" :key="index" @tap="switchTab(item)">
			<image class="img" :src="item.img + (curIndex == index ? '-on.png' : '.png')"></image>
			<text class="text">{{item.text}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"tab-bar",
		props:{
			resdata:[Array,Object],
			currentIndex: {
				type: Number,
				default: 0
			}
		},
		computed: {
			curIndex(){
				return this.currentIndex
			}
		},
		data() {
			return {
				list: [
					{
						img: '/static/tabbar/kj',
						text: "查询"
					},
					{
						img: '/static/tabbar/zj',
						text: "专家列表"
					},
					{
						img: '/static/tabbar/time',
						text: "时间"
					},
					{
						img: '/static/tabbar/jiang',
						text: "奖表长条"
					}
				],
				// curIndex: 0
			};
		},
		methods: {
			switchTab(item){
				console.log(item)
				uni.switchTab({
					url: item.url
				})
			}
		}
	}
</script>

<style>
.img{
	width: 50upx;
	height: 50upx;
}
.text{
	font-size: 12upx
}
</style>